package com.mf.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mf.entity.DayLog;
import com.mf.service.IDayLogService;
import com.mf.utils.Result;
import com.mf.vo.DayLog.DayLogPageVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mf
 * @since 2024-05-17
 */
@RestController
@RequestMapping("/stock/dayLog")
@Tag(name="日志")
public class DayLogController {
    @Resource
    private IDayLogService dayLogService;

    @Operation(summary = "新增日志")
    @PostMapping("/addDayLog")
    public Result<Boolean> addDayLog(@RequestBody DayLog dayLog)
    {
        return Result.success(dayLogService.save(dayLog));
    }

    @Operation(summary = "查询日志")
    @PostMapping("/findDayLog")
    public Result<Page<DayLog>> findDayLog(@RequestBody DayLogPageVo dayLog)
    {
        return Result.success(dayLogService.findDayLogPage(dayLog));
    }

    @Operation(summary = "删除日志")
    @GetMapping("/deleteDayLog")
    public Result<Boolean> deleteDayLog(@RequestParam("id") Integer id)
    {
        return Result.success(dayLogService.removeById(id));
    }
}
